/* CSS变量定义 */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --text-color: #333;
    --background-color: #f5f5f5;
    --card-background: #fff;
    --border-color: #ddd;
    --hover-color: #2980b9;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 6px;
    --sidebar-width: 350px;
    --header-height: 80px;
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

/* 容器样式 */
.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 头部样式 */
.header {
    height: var(--header-height);
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow);
}

.header h1 {
    color: var(--primary-color);
    font-size: 24px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-background);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    margin-bottom: 15px;
    font-size: 18px;
}

.search-container {
    display: flex;
    gap: 10px;
}

.search-container input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.template-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.template-section h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-btn {
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: left;
    transition: all 0.3s;
}

.template-btn:hover {
    background-color: #e9ecef;
}

.log-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.no-logs {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

.log-item {
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s;
}

.log-item:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.log-item.active {
    background-color: #e3f2fd;
    border-color: var(--primary-color);
}

.log-item h4 {
    margin-bottom: 5px;
    font-size: 16px;
}

.log-item p {
    font-size: 14px;
    color: #666;
}

/* 编辑器区域 */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--card-background);
}

.editor-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.editor-header input {
    flex: 1;
    padding: 10px 15px;
    font-size: 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background-color: #f8f9fa;
}

.tab-btn.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-content {
    flex: 1;
    overflow: hidden;
}

.tab-pane {
    display: none;
    height: 100%;
    overflow: auto;
}

.tab-pane.active {
    display: block;
}

/* 表单样式 */
.editor-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.problem-item,
.solution-item {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.problem-item h4,
.solution-item h4 {
    margin-bottom: 10px;
    font-size: 16px;
}

.problem-item textarea,
.solution-item textarea {
    margin-bottom: 10px;
}

/* 预览样式 */
.markdown-preview {
    padding: 20px;
}

.markdown-preview h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.markdown-preview h3 {
    margin: 20px 0 10px;
    color: var(--text-color);
}

.markdown-preview h4 {
    margin: 15px 0 8px;
    color: var(--text-color);
}

.markdown-preview p {
    margin-bottom: 10px;
}

.markdown-preview ul,
.markdown-preview ol {
    margin: 10px 0 10px 20px;
}

.markdown-preview li {
    margin-bottom: 5px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--hover-color);
}

.secondary-btn {
    background-color: #6c757d;
    color: white;
}

.secondary-btn:hover {
    background-color: #5a6268;
}

.danger-btn {
    background-color: var(--danger-color);
    color: white;
}

.danger-btn:hover {
    background-color: #c0392b;
}

.small-btn {
    padding: 5px 10px;
    font-size: 12px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close-modal {
    font-size: 28px;
    cursor: pointer;
    color: #666;
}

.close-modal:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 300px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 30%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .editor-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .editor-actions {
        justify-content: center;
    }
}